home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / QD3D.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  40.6 KB  |  1,194 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3D.h
  3.  
  4.      Contains:    Base types for Quickdraw 3D                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3D__
  18. #define __QD3D__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21. #include <ConditionalMacros.h>
  22. #endif
  23.  
  24. #if TARGET_OS_MAC
  25. #ifndef __MACTYPES__
  26. #include <MacTypes.h>
  27. #endif
  28. #endif  /* TARGET_OS_MAC */
  29.  
  30. #include <stdio.h>
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=power
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. #if PRAGMA_ENUM_ALWAYSINT
  54.     #pragma enumsalwaysint on
  55. #elif PRAGMA_ENUM_OPTIONS
  56.     #pragma option enum=int
  57. #elif PRAGMA_ENUM_PACK
  58.     #if __option(pack_enums)
  59.         #define PRAGMA_ENUM_PACK__QD3D__
  60.     #endif
  61.     #pragma options(!pack_enums)
  62. #endif
  63.  
  64. #if TARGET_OS_MAC
  65. #define OS_MACINTOSH 1
  66. #define OS_WIN32 0
  67. #define OS_UNIX 0
  68. #define OS_NEXT 0
  69. #define WINDOW_SYSTEM_MACINTOSH 1
  70. #define WINDOW_SYSTEM_WIN32 0
  71. #define WINDOW_SYSTEM_X11 0
  72. #define WINDOW_SYSTEM_NEXT 0
  73. #endif  /* TARGET_OS_MAC */
  74.  
  75. #if TARGET_OS_WIN32
  76. #define OS_MACINTOSH 0
  77. #define OS_WIN32 1
  78. #define OS_UNIX 0
  79. #define OS_NEXT 0
  80. #define WINDOW_SYSTEM_MACINTOSH 0
  81. #define WINDOW_SYSTEM_WIN32 1
  82. #define WINDOW_SYSTEM_X11 0
  83. #define WINDOW_SYSTEM_NEXT 0
  84. #endif  /* TARGET_OS_WIN32 */
  85.  
  86. #if TARGET_OS_UNIX
  87. #define OS_MACINTOSH 0
  88. #define OS_WIN32 0
  89. #define WINDOW_SYSTEM_MACINTOSH 0
  90. #define WINDOW_SYSTEM_WIN32 0
  91. #if NeXT
  92. #define OS_UNIX 0
  93. #define OS_NEXT 1
  94. #define WINDOW_SYSTEM_X11 0
  95. #define WINDOW_SYSTEM_NEXT 1
  96. #else
  97. #define OS_UNIX 1
  98. #define OS_NEXT 0
  99. #define WINDOW_SYSTEM_X11 1
  100. #define WINDOW_SYSTEM_NEXT 0
  101. #endif  /* NeXT */
  102.  
  103. #endif  /* TARGET_OS_UNIX */
  104.  
  105.  
  106. /******************************************************************************
  107.  **                                                                             **
  108.  **                                Export Control                                 **
  109.  **                                                                             **
  110.  *****************************************************************************/
  111. #if TARGET_OS_WIN32
  112.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  113.         #define QD3D_EXPORT __declspec( dllexport )     
  114.         #define QD3D_CALL    
  115.         #define QD3D_CALLBACK    
  116.     #else
  117.         #define QD3D_EXPORT __declspec( dllimport )    
  118.         #define QD3D_CALL    __cdecl
  119.         #define QD3D_CALLBACK    __cdecl    
  120.     #endif /* WIN32_EXPORTING */
  121. #else
  122.     #define QD3D_EXPORT
  123.     #define QD3D_CALL    
  124.     #define QD3D_CALLBACK    
  125. #endif  /*  TARGET_OS_WIN32  */
  126.  
  127.  
  128. /******************************************************************************
  129.  **                                                                             **
  130.  **                                NULL definition                                 **
  131.  **                                                                             **
  132.  *****************************************************************************/
  133.  
  134. #ifndef NULL
  135.     #error /*    NULL is undefined?    */
  136. #endif /* NULL */
  137.  
  138. /******************************************************************************
  139.  **                                                                             **
  140.  **                                    Objects                                     **
  141.  **                                                                             **
  142.  *****************************************************************************/
  143. /*
  144.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  145.  * deletion, duplication, and i/o methods.
  146.  */
  147. typedef long                             TQ3ObjectType;
  148. typedef struct OpaqueTQ3Object*         TQ3Object;
  149. /* */
  150. /*
  151.  * There are four subclasses of OBJECT:
  152.  *    an ELEMENT, which is data that is placed in a SET
  153.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  154.  *    VIEWs, which maintain state information for an image
  155.  *    a PICK, which used to query a VIEW
  156.  */
  157. typedef TQ3Object                         TQ3ElementObject;
  158. typedef TQ3Object                         TQ3SharedObject;
  159. typedef TQ3Object                         TQ3ViewObject;
  160. typedef TQ3Object                         TQ3PickObject;
  161. /*
  162.  * There are several types of SharedObjects:
  163.  *    RENDERERs, which paint to a drawContext
  164.  *    DRAWCONTEXTs, which are an interface to a device 
  165.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  166.  *    FILEs, which maintain state information for a metafile
  167.  *    SHAPEs, which affect the state of the View
  168.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  169.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  170.  *    TRACKERs, which represent a position and orientation in the user interface
  171.  *  STRINGs, which are abstractions of text string data.
  172.  *    STORAGE, which is an abstraction for stream-based data storage (files, memory)
  173.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  174.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  175.  */
  176. typedef TQ3SharedObject                 TQ3RendererObject;
  177. typedef TQ3SharedObject                 TQ3DrawContextObject;
  178. typedef TQ3SharedObject                 TQ3SetObject;
  179. typedef TQ3SharedObject                 TQ3FileObject;
  180. typedef TQ3SharedObject                 TQ3ShapeObject;
  181. typedef TQ3SharedObject                 TQ3ShapePartObject;
  182. typedef TQ3SharedObject                 TQ3ControllerStateObject;
  183. typedef TQ3SharedObject                 TQ3TrackerObject;
  184. typedef TQ3SharedObject                 TQ3StringObject;
  185. typedef TQ3SharedObject                 TQ3StorageObject;
  186. typedef TQ3SharedObject                 TQ3TextureObject;
  187. typedef TQ3SharedObject                 TQ3ViewHintsObject;
  188. /*
  189.  * There is one types of SET:
  190.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  191.  */
  192. typedef TQ3SetObject                     TQ3AttributeSet;
  193. /*
  194.  * There are many types of SHAPEs:
  195.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  196.  *    CAMERAs, which affects the location and orientation of the RENDERER in space
  197.  *    GROUPs, which may contain any number of SHARED OBJECTS
  198.  *    GEOMETRYs, which are representations of three-dimensional data
  199.  *    SHADERs, which affect how colors are drawn on a geometry
  200.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  201.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  202.  *    REFERENCEs, which are references to objects in FILEs
  203.  *  UNKNOWN, which hold unknown objects read from a metafile.
  204.  */
  205. typedef TQ3ShapeObject                     TQ3GroupObject;
  206. typedef TQ3ShapeObject                     TQ3GeometryObject;
  207. typedef TQ3ShapeObject                     TQ3ShaderObject;
  208. typedef TQ3ShapeObject                     TQ3StyleObject;
  209. typedef TQ3ShapeObject                     TQ3TransformObject;
  210. typedef TQ3ShapeObject                     TQ3LightObject;
  211. typedef TQ3ShapeObject                     TQ3CameraObject;
  212. typedef TQ3ShapeObject                     TQ3UnknownObject;
  213. typedef TQ3ShapeObject                     TQ3ReferenceObject;
  214. /*
  215.  * For now, there is only one type of SHAPEPARTs:
  216.  *    MESHPARTs, which describe some part of a mesh
  217.  */
  218. typedef TQ3ShapePartObject                 TQ3MeshPartObject;
  219. /*
  220.  * There are three types of MESHPARTs:
  221.  *    MESHFACEPARTs, which describe a face of a mesh
  222.  *    MESHEDGEPARTs, which describe a edge of a mesh
  223.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  224.  */
  225. typedef TQ3MeshPartObject                 TQ3MeshFacePartObject;
  226. typedef TQ3MeshPartObject                 TQ3MeshEdgePartObject;
  227. typedef TQ3MeshPartObject                 TQ3MeshVertexPartObject;
  228. /*
  229.  * A DISPLAY Group can be drawn to a view
  230.  */
  231. typedef TQ3GroupObject                     TQ3DisplayGroupObject;
  232. /*
  233.  * There are many types of SHADERs:
  234.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  235.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  236.  */
  237. typedef TQ3ShaderObject                 TQ3SurfaceShaderObject;
  238. typedef TQ3ShaderObject                 TQ3IlluminationShaderObject;
  239. /*
  240.  * A handle to an object in a group
  241.  */
  242. typedef struct OpaqueTQ3GroupPosition*     TQ3GroupPosition;
  243. /* 
  244.  * TQ3ObjectClassNameString is used for the class name of an object
  245.  */
  246.  
  247. enum {
  248.     kQ3StringMaximumLength        = 1024
  249. };
  250.  
  251.  
  252. typedef char TQ3ObjectClassNameString[kQ3StringMaximumLength];
  253.  
  254.  
  255. /******************************************************************************
  256.  **                                                                             **
  257.  **                            Client/Server Things                             **
  258.  **                                                                             **
  259.  *****************************************************************************/
  260. typedef void *                            TQ3ControllerRef;
  261. /******************************************************************************
  262.  **                                                                             **
  263.  **                            Flags and Switches                                 **
  264.  **                                                                             **
  265.  *****************************************************************************/
  266.  
  267. enum TQ3Boolean {
  268.     kQ3False                    = 0,
  269.     kQ3True                        = 1
  270. };
  271. typedef enum TQ3Boolean TQ3Boolean;
  272.  
  273.  
  274. enum TQ3Switch {
  275.     kQ3Off                        = 0,
  276.     kQ3On                        = 1
  277. };
  278. typedef enum TQ3Switch TQ3Switch;
  279.  
  280.  
  281. enum TQ3Status {
  282.     kQ3Failure                    = 0,
  283.     kQ3Success                    = 1
  284. };
  285. typedef enum TQ3Status TQ3Status;
  286.  
  287.  
  288. enum TQ3Axis {
  289.     kQ3AxisX                    = 0,
  290.     kQ3AxisY                    = 1,
  291.     kQ3AxisZ                    = 2
  292. };
  293. typedef enum TQ3Axis TQ3Axis;
  294.  
  295.  
  296. enum TQ3PixelType {
  297.     kQ3PixelTypeRGB32            = 0,                            /* Alpha:8 (ignored), R:8, G:8, B:8    */
  298.     kQ3PixelTypeARGB32            = 1,                            /* Alpha:8, R:8, G:8, B:8             */
  299.     kQ3PixelTypeRGB16            = 2,                            /* Alpha:1 (ignored), R:5, G:5, B:5    */
  300.     kQ3PixelTypeARGB16            = 3,                            /* Alpha:1, R:5, G:5, B:5             */
  301.     kQ3PixelTypeRGB16_565        = 4,                            /* Win32 only: 16 bits/pixel, R:5, G:6, B:5        */
  302.     kQ3PixelTypeRGB24            = 5                                /* Win32 only: 24 bits/pixel, R:8, G:8, B:8        */
  303. };
  304. typedef enum TQ3PixelType TQ3PixelType;
  305.  
  306.  
  307. enum TQ3Endian {
  308.     kQ3EndianBig                = 0,
  309.     kQ3EndianLittle                = 1
  310. };
  311. typedef enum TQ3Endian TQ3Endian;
  312.  
  313.  
  314. enum TQ3EndCapMasks {
  315.     kQ3EndCapNone                = 0,
  316.     kQ3EndCapMaskTop            = 1 << 0,
  317.     kQ3EndCapMaskBottom            = 1 << 1,
  318.     kQ3EndCapMaskInterior        = 1 << 2
  319. };
  320. typedef enum TQ3EndCapMasks TQ3EndCapMasks;
  321.  
  322. typedef unsigned long                     TQ3EndCap;
  323.  
  324. enum {
  325.     kQ3ArrayIndexNULL = ~0    
  326. };
  327.  
  328.  
  329. /******************************************************************************
  330.  **                                                                             **
  331.  **                        Point and Vector Definitions                         **
  332.  **                                                                             **
  333.  *****************************************************************************/
  334.  
  335. struct TQ3Vector2D {
  336.     float                             x;
  337.     float                             y;
  338. };
  339. typedef struct TQ3Vector2D                TQ3Vector2D;
  340.  
  341. struct TQ3Vector3D {
  342.     float                             x;
  343.     float                             y;
  344.     float                             z;
  345. };
  346. typedef struct TQ3Vector3D                TQ3Vector3D;
  347.  
  348. struct TQ3Point2D {
  349.     float                             x;
  350.     float                             y;
  351. };
  352. typedef struct TQ3Point2D                TQ3Point2D;
  353.  
  354. struct TQ3Point3D {
  355.     float                             x;
  356.     float                             y;
  357.     float                             z;
  358. };
  359. typedef struct TQ3Point3D                TQ3Point3D;
  360.  
  361. struct TQ3RationalPoint4D {
  362.     float                             x;
  363.     float                             y;
  364.     float                             z;
  365.     float                             w;
  366. };
  367. typedef struct TQ3RationalPoint4D        TQ3RationalPoint4D;
  368.  
  369. struct TQ3RationalPoint3D {
  370.     float                             x;
  371.     float                             y;
  372.     float                             w;
  373. };
  374. typedef struct TQ3RationalPoint3D        TQ3RationalPoint3D;
  375. /******************************************************************************
  376.  **                                                                             **
  377.  **                                Quaternion                                     **
  378.  **                                                                             **
  379.  *****************************************************************************/
  380.  
  381. struct TQ3Quaternion {
  382.     float                             w;
  383.     float                             x;
  384.     float                             y;
  385.     float                             z;
  386. };
  387. typedef struct TQ3Quaternion            TQ3Quaternion;
  388. /******************************************************************************
  389.  **                                                                             **
  390.  **                                Ray Definition                                 **
  391.  **                                                                             **
  392.  *****************************************************************************/
  393.  
  394. struct TQ3Ray3D {
  395.     TQ3Point3D                         origin;
  396.     TQ3Vector3D                     direction;
  397. };
  398. typedef struct TQ3Ray3D                    TQ3Ray3D;
  399. /******************************************************************************
  400.  **                                                                             **
  401.  **                        Parameterization Data Structures                     **
  402.  **                                                                             **
  403.  *****************************************************************************/
  404.  
  405. struct TQ3Param2D {
  406.     float                             u;
  407.     float                             v;
  408. };
  409. typedef struct TQ3Param2D                TQ3Param2D;
  410.  
  411. struct TQ3Param3D {
  412.     float                             u;
  413.     float                             v;
  414.     float                             w;
  415. };
  416. typedef struct TQ3Param3D                TQ3Param3D;
  417.  
  418. struct TQ3Tangent2D {
  419.     TQ3Vector3D                     uTangent;
  420.     TQ3Vector3D                     vTangent;
  421. };
  422. typedef struct TQ3Tangent2D                TQ3Tangent2D;
  423.  
  424. struct TQ3Tangent3D {
  425.     TQ3Vector3D                     uTangent;
  426.     TQ3Vector3D                     vTangent;
  427.     TQ3Vector3D                     wTangent;
  428. };
  429. typedef struct TQ3Tangent3D                TQ3Tangent3D;
  430. /******************************************************************************
  431.  **                                                                             **
  432.  **                        Polar and Spherical Coordinates                         **
  433.  **                                                                             **
  434.  *****************************************************************************/
  435.  
  436. struct TQ3PolarPoint {
  437.     float                             r;
  438.     float                             theta;
  439. };
  440. typedef struct TQ3PolarPoint            TQ3PolarPoint;
  441.  
  442. struct TQ3SphericalPoint {
  443.     float                             rho;
  444.     float                             theta;
  445.     float                             phi;
  446. };
  447. typedef struct TQ3SphericalPoint        TQ3SphericalPoint;
  448. /******************************************************************************
  449.  **                                                                             **
  450.  **                            Color Definition                                 **
  451.  **                                                                             **
  452.  *****************************************************************************/
  453.  
  454. struct TQ3ColorRGB {
  455.     float                             r;
  456.     float                             g;
  457.     float                             b;
  458. };
  459. typedef struct TQ3ColorRGB                TQ3ColorRGB;
  460.  
  461. struct TQ3ColorARGB {
  462.     float                             a;
  463.     float                             r;
  464.     float                             g;
  465.     float                             b;
  466. };
  467. typedef struct TQ3ColorARGB                TQ3ColorARGB;
  468. /******************************************************************************
  469.  **                                                                             **
  470.  **                                    Vertices                                 **
  471.  **                                                                             **
  472.  *****************************************************************************/
  473.  
  474. struct TQ3Vertex3D {
  475.     TQ3Point3D                         point;
  476.     TQ3AttributeSet                 attributeSet;
  477. };
  478. typedef struct TQ3Vertex3D                TQ3Vertex3D;
  479. /******************************************************************************
  480.  **                                                                             **
  481.  **                                    Matrices                                 **
  482.  **                                                                             **
  483.  *****************************************************************************/
  484.  
  485. struct TQ3Matrix3x3 {
  486.     float                             value[3][3];
  487. };
  488. typedef struct TQ3Matrix3x3                TQ3Matrix3x3;
  489.  
  490. struct TQ3Matrix4x4 {
  491.     float                             value[4][4];
  492. };
  493. typedef struct TQ3Matrix4x4                TQ3Matrix4x4;
  494. /******************************************************************************
  495.  **                                                                             **
  496.  **                                Bitmap/Pixmap                                 **
  497.  **                                                                             **
  498.  *****************************************************************************/
  499.  
  500. struct TQ3Pixmap {
  501.     void *                            image;
  502.     unsigned long                     width;
  503.     unsigned long                     height;
  504.     unsigned long                     rowBytes;
  505.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  506.     TQ3PixelType                     pixelType;
  507.     TQ3Endian                         bitOrder;
  508.     TQ3Endian                         byteOrder;
  509. };
  510. typedef struct TQ3Pixmap                TQ3Pixmap;
  511.  
  512. struct TQ3StoragePixmap {
  513.     TQ3StorageObject                 image;
  514.     unsigned long                     width;
  515.     unsigned long                     height;
  516.     unsigned long                     rowBytes;
  517.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  518.     TQ3PixelType                     pixelType;
  519.     TQ3Endian                         bitOrder;
  520.     TQ3Endian                         byteOrder;
  521. };
  522. typedef struct TQ3StoragePixmap            TQ3StoragePixmap;
  523.  
  524. struct TQ3Bitmap {
  525.     unsigned char *                    image;
  526.     unsigned long                     width;
  527.     unsigned long                     height;
  528.     unsigned long                     rowBytes;
  529.     TQ3Endian                         bitOrder;
  530. };
  531. typedef struct TQ3Bitmap                TQ3Bitmap;
  532.  
  533. struct TQ3MipmapImage {                                            /* An image for use as a texture mipmap  */
  534.     unsigned long                     width;                        /* Width of mipmap, must be power of 2   */
  535.     unsigned long                     height;                        /* Height of mipmap, must be power of 2  */
  536.     unsigned long                     rowBytes;                    /* Rowbytes of mipmap                    */
  537.     unsigned long                     offset;                        /* Offset from image base to this mipmap */
  538. };
  539. typedef struct TQ3MipmapImage            TQ3MipmapImage;
  540.  
  541. struct TQ3Mipmap {
  542.     TQ3StorageObject                 image;                        /* Data containing the texture map and      */
  543.                                                                 /* if (useMipmapping==kQ3True) the          */
  544.                                                                 /* mipmap data                              */
  545.     TQ3Boolean                         useMipmapping;                /* True if mipmapping should be used      */
  546.                                                                 /* and all mipmaps have been provided    */
  547.     TQ3PixelType                     pixelType;
  548.     TQ3Endian                         bitOrder;
  549.     TQ3Endian                         byteOrder;
  550.     unsigned long                     reserved;                    /* leave NULL for next version             */
  551.     TQ3MipmapImage                     mipmaps[32];                /* The actual number of mipmaps is determined from the size of the first mipmap */
  552. };
  553. typedef struct TQ3Mipmap                TQ3Mipmap;
  554.  
  555. /******************************************************************************
  556.  **                                                                             **
  557.  **                        Higher dimension quantities                             **
  558.  **                                                                             **
  559.  *****************************************************************************/
  560.  
  561. struct TQ3Area {
  562.     TQ3Point2D                         min;
  563.     TQ3Point2D                         max;
  564. };
  565. typedef struct TQ3Area                    TQ3Area;
  566.  
  567. struct TQ3PlaneEquation {
  568.     TQ3Vector3D                     normal;
  569.     float                             constant;
  570. };
  571. typedef struct TQ3PlaneEquation            TQ3PlaneEquation;
  572.  
  573. struct TQ3BoundingBox {
  574.     TQ3Point3D                         min;
  575.     TQ3Point3D                         max;
  576.     TQ3Boolean                         isEmpty;
  577. };
  578. typedef struct TQ3BoundingBox            TQ3BoundingBox;
  579.  
  580. struct TQ3BoundingSphere {
  581.     TQ3Point3D                         origin;
  582.     float                             radius;
  583.     TQ3Boolean                         isEmpty;
  584. };
  585. typedef struct TQ3BoundingSphere        TQ3BoundingSphere;
  586. /*
  587.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  588.  *    calls in the View. It's a hint to the system as to how it should 
  589.  *    compute the bbox of a shape:
  590.  *
  591.  *    kQ3ComputeBoundsExact:    
  592.  *        Vertices of shapes are transformed into world space and
  593.  *        the world space bounding box is computed from them.  Slow!
  594.  *    
  595.  *    kQ3ComputeBoundsApproximate: 
  596.  *        A local space bounding box is computed from a shape's
  597.  *        vertices.  This bbox is then transformed into world space,
  598.  *        and its bounding box is taken as the shape's approximate
  599.  *        bbox.  Fast but the bbox is larger than optimal.
  600.  */
  601.  
  602. enum TQ3ComputeBounds {
  603.     kQ3ComputeBoundsExact        = 0,
  604.     kQ3ComputeBoundsApproximate    = 1
  605. };
  606. typedef enum TQ3ComputeBounds TQ3ComputeBounds;
  607.  
  608.  
  609. /******************************************************************************
  610.  **                                                                             **
  611.  **                            Object System Types                                 **
  612.  **                                                                             **
  613.  *****************************************************************************/
  614.  
  615. typedef struct OpaqueTQ3XObjectClass*     TQ3XObjectClass;
  616.  
  617. typedef unsigned long                     TQ3XMethodType;
  618. /*
  619.  * Object methods
  620.  */
  621. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  622. /* 
  623.  *  Return true from the metahandler if this 
  624.  *  object can be submitted in a rendering loop 
  625.  */
  626. #define kQ3XMethodTypeObjectIsDrawable        Q3_METHOD_TYPE('i','s','d','r')    /* return true from the metahandler if this object can be submitted in a rendering loop */
  627. typedef CALLBACK_API_C( void , TQ3XFunctionPointer )(void );
  628. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XMetaHandler )(TQ3XMethodType methodType);
  629. /*
  630.  * MetaHandler:
  631.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  632.  *        times to build method tables, and then is thrown away. You are 
  633.  *        guaranteed that your metahandler will never be called again after a 
  634.  *        call that was passed a metahandler returns.
  635.  *
  636.  *        Your metahandler should contain a switch on the methodType passed to it
  637.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  638.  *
  639.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  640.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  641.  *
  642.  *        These types here are prototypes of how your functions should look.
  643.  */
  644. typedef CALLBACK_API_C( TQ3Status , TQ3XObjectUnregisterMethod )(TQ3XObjectClass objectClass);
  645. /*
  646.  * See QD3DIO.h for the IO method types: 
  647.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  648.  */
  649.  
  650. /******************************************************************************
  651.  **                                                                             **
  652.  **                                Set Types                                     **
  653.  **                                                                             **
  654.  *****************************************************************************/
  655. typedef long                             TQ3ElementType;
  656.  
  657. enum {
  658.     kQ3ElementTypeNone            = 0,
  659.     kQ3ElementTypeUnknown        = 32,
  660.     kQ3ElementTypeSet            = 33
  661. };
  662.  
  663.  
  664. /* 
  665.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  666.  *    
  667.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  668.  *        
  669.  *        Note that the object is always referenced when copying around. 
  670.  *        
  671.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  672.  *        group of other "objects" which have been found in the metafile and
  673.  *        have no attachment method to their parent. Be prepared to handle
  674.  *        any or all of these cases if you actually access the set on a shape.
  675.  *
  676.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  677.  *    
  678.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  679.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  680.  *            
  681.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  682.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  683.  *    
  684.  *        Note that the object is always referenced when copying around. 
  685.  *        
  686.  *    See the note below about the Set and Shape changes.
  687.  */
  688.  
  689. /******************************************************************************
  690.  **                                                                             **
  691.  **                            Object System Macros                             **
  692.  **                                                                             **
  693.  *****************************************************************************/
  694.  
  695. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  696.             ((const unsigned long)                     \
  697.             ((const unsigned long) (a) << 24) |     \
  698.             ((const unsigned long) (b) << 16) |        \
  699.             ((const unsigned long) (c) << 8)  |     \
  700.             ((const unsigned long) (d)))
  701.  
  702. #define Q3_OBJECT_TYPE(a,b,c,d) \
  703.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  704.  
  705. #define Q3_METHOD_TYPE(a,b,c,d) \
  706.     ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  707.  
  708. /******************************************************************************
  709.  **                                                                             **
  710.  **                                Object Types                                 **
  711.  **                                                                             **
  712.  *****************************************************************************/
  713. /*
  714.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  715.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  716.  */
  717.  
  718. #define kQ3ObjectTypeInvalid                            0L
  719. #define kQ3ObjectTypeView                                ((TQ3ObjectType)FOUR_CHAR_CODE('view'))
  720. #define kQ3ObjectTypeElement                            ((TQ3ObjectType)FOUR_CHAR_CODE('elmn'))
  721.     #define kQ3ElementTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('eatt'))
  722. #define kQ3ObjectTypePick                                ((TQ3ObjectType)FOUR_CHAR_CODE('pick'))
  723.     #define kQ3PickTypeWindowPoint                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwp'))
  724.     #define kQ3PickTypeWindowRect                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwr'))
  725. #define kQ3ObjectTypeShared                                ((TQ3ObjectType)FOUR_CHAR_CODE('shrd'))
  726.     #define kQ3SharedTypeRenderer                        ((TQ3ObjectType)FOUR_CHAR_CODE('rddr'))
  727.         #define kQ3RendererTypeWireFrame                ((TQ3ObjectType)FOUR_CHAR_CODE('wrfr'))
  728.         #define kQ3RendererTypeGeneric                    ((TQ3ObjectType)FOUR_CHAR_CODE('gnrr'))
  729.         #define kQ3RendererTypeInteractive                ((TQ3ObjectType)FOUR_CHAR_CODE('ctwn'))
  730.     #define kQ3SharedTypeShape                            ((TQ3ObjectType)FOUR_CHAR_CODE('shap'))
  731.  
  732.             
  733.         #define kQ3ShapeTypeGeometry                    ((TQ3ObjectType)FOUR_CHAR_CODE('gmtr'))
  734.             #define kQ3GeometryTypeBox                    ((TQ3ObjectType)FOUR_CHAR_CODE('box '))
  735.             #define kQ3GeometryTypeGeneralPolygon        ((TQ3ObjectType)FOUR_CHAR_CODE('gpgn'))
  736.             #define kQ3GeometryTypeLine                    ((TQ3ObjectType)FOUR_CHAR_CODE('line'))
  737.             #define kQ3GeometryTypeMarker                ((TQ3ObjectType)FOUR_CHAR_CODE('mrkr'))
  738.             #define kQ3GeometryTypePixmapMarker            ((TQ3ObjectType)FOUR_CHAR_CODE('mrkp'))
  739.             #define kQ3GeometryTypeMesh                    ((TQ3ObjectType)FOUR_CHAR_CODE('mesh'))
  740.             #define kQ3GeometryTypeNURBCurve            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbc'))
  741.             #define kQ3GeometryTypeNURBPatch            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbp'))
  742.             #define kQ3GeometryTypePoint                ((TQ3ObjectType)FOUR_CHAR_CODE('pnt '))
  743.             #define kQ3GeometryTypePolygon                ((TQ3ObjectType)FOUR_CHAR_CODE('plyg'))
  744.             #define kQ3GeometryTypePolyLine                ((TQ3ObjectType)FOUR_CHAR_CODE('plyl'))
  745.             #define kQ3GeometryTypeTriangle                ((TQ3ObjectType)FOUR_CHAR_CODE('trng'))
  746.             #define kQ3GeometryTypeTriGrid                ((TQ3ObjectType)FOUR_CHAR_CODE('trig'))
  747.             #define kQ3GeometryTypeCone                    ((TQ3ObjectType)FOUR_CHAR_CODE('cone'))
  748.             #define kQ3GeometryTypeCylinder                ((TQ3ObjectType)FOUR_CHAR_CODE('cyln'))
  749.             #define kQ3GeometryTypeDisk                    ((TQ3ObjectType)FOUR_CHAR_CODE('disk'))
  750.             #define kQ3GeometryTypeEllipse                ((TQ3ObjectType)FOUR_CHAR_CODE('elps'))
  751.             #define kQ3GeometryTypeEllipsoid            ((TQ3ObjectType)FOUR_CHAR_CODE('elpd'))
  752.             #define kQ3GeometryTypePolyhedron            ((TQ3ObjectType)FOUR_CHAR_CODE('plhd'))
  753.             #define kQ3GeometryTypeTorus                ((TQ3ObjectType)FOUR_CHAR_CODE('tors'))
  754.             #define kQ3GeometryTypeTriMesh                ((TQ3ObjectType)FOUR_CHAR_CODE('tmsh'))
  755.  
  756.             
  757.         #define kQ3ShapeTypeShader                        ((TQ3ObjectType)FOUR_CHAR_CODE('shdr'))
  758.             #define kQ3ShaderTypeSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('sush'))
  759.                 #define kQ3SurfaceShaderTypeTexture        ((TQ3ObjectType)FOUR_CHAR_CODE('txsu'))
  760.             #define kQ3ShaderTypeIllumination            ((TQ3ObjectType)FOUR_CHAR_CODE('ilsh'))
  761.                 #define kQ3IlluminationTypePhong        ((TQ3ObjectType)FOUR_CHAR_CODE('phil'))
  762.                 #define kQ3IlluminationTypeLambert        ((TQ3ObjectType)FOUR_CHAR_CODE('lmil'))
  763.                 #define kQ3IlluminationTypeNULL            ((TQ3ObjectType)FOUR_CHAR_CODE('nuil'))
  764.         #define kQ3ShapeTypeStyle                        ((TQ3ObjectType)FOUR_CHAR_CODE('styl'))
  765.             #define kQ3StyleTypeBackfacing                ((TQ3ObjectType)FOUR_CHAR_CODE('bckf'))
  766.             #define kQ3StyleTypeInterpolation            ((TQ3ObjectType)FOUR_CHAR_CODE('intp'))
  767.             #define kQ3StyleTypeFill                    ((TQ3ObjectType)FOUR_CHAR_CODE('fist'))
  768.             #define kQ3StyleTypePickID                    ((TQ3ObjectType)FOUR_CHAR_CODE('pkid'))
  769.             #define kQ3StyleTypeReceiveShadows            ((TQ3ObjectType)FOUR_CHAR_CODE('rcsh'))
  770.             #define kQ3StyleTypeHighlight                ((TQ3ObjectType)FOUR_CHAR_CODE('high'))
  771.             #define kQ3StyleTypeSubdivision                ((TQ3ObjectType)FOUR_CHAR_CODE('sbdv'))
  772.             #define kQ3StyleTypeOrientation                ((TQ3ObjectType)FOUR_CHAR_CODE('ofdr'))
  773.             #define kQ3StyleTypePickParts                ((TQ3ObjectType)FOUR_CHAR_CODE('pkpt'))
  774.             #define kQ3StyleTypeAntiAlias                ((TQ3ObjectType)FOUR_CHAR_CODE('anti'))
  775.  
  776.             
  777.         #define kQ3ShapeTypeTransform                    ((TQ3ObjectType)FOUR_CHAR_CODE('xfrm'))
  778.             #define kQ3TransformTypeMatrix                ((TQ3ObjectType)FOUR_CHAR_CODE('mtrx'))
  779.             #define kQ3TransformTypeScale                ((TQ3ObjectType)FOUR_CHAR_CODE('scal'))
  780.             #define kQ3TransformTypeTranslate            ((TQ3ObjectType)FOUR_CHAR_CODE('trns'))
  781.             #define kQ3TransformTypeRotate                ((TQ3ObjectType)FOUR_CHAR_CODE('rott'))
  782.             #define kQ3TransformTypeRotateAboutPoint     ((TQ3ObjectType)FOUR_CHAR_CODE('rtap'))
  783.             #define kQ3TransformTypeRotateAboutAxis     ((TQ3ObjectType)FOUR_CHAR_CODE('rtaa'))
  784.             #define kQ3TransformTypeQuaternion            ((TQ3ObjectType)FOUR_CHAR_CODE('qtrn'))
  785.             #define kQ3TransformTypeReset                ((TQ3ObjectType)FOUR_CHAR_CODE('rset'))
  786.         #define kQ3ShapeTypeLight                        ((TQ3ObjectType)FOUR_CHAR_CODE('lght'))
  787.             #define kQ3LightTypeAmbient                    ((TQ3ObjectType)FOUR_CHAR_CODE('ambn'))
  788.             #define kQ3LightTypeDirectional                ((TQ3ObjectType)FOUR_CHAR_CODE('drct'))
  789.             #define kQ3LightTypePoint                    ((TQ3ObjectType)FOUR_CHAR_CODE('pntl'))
  790.             #define kQ3LightTypeSpot                    ((TQ3ObjectType)FOUR_CHAR_CODE('spot'))
  791.         #define kQ3ShapeTypeCamera                        ((TQ3ObjectType)FOUR_CHAR_CODE('cmra'))
  792.             #define kQ3CameraTypeOrthographic            ((TQ3ObjectType)FOUR_CHAR_CODE('orth'))
  793.             #define kQ3CameraTypeViewPlane                ((TQ3ObjectType)FOUR_CHAR_CODE('vwpl'))
  794.             #define kQ3CameraTypeViewAngleAspect        ((TQ3ObjectType)FOUR_CHAR_CODE('vana'))
  795.         #define kQ3ShapeTypeGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('grup'))
  796.             #define kQ3GroupTypeDisplay                    ((TQ3ObjectType)FOUR_CHAR_CODE('dspg'))
  797.                 #define kQ3DisplayGroupTypeOrdered        ((TQ3ObjectType)FOUR_CHAR_CODE('ordg'))
  798.                 #define kQ3DisplayGroupTypeIOProxy        ((TQ3ObjectType)FOUR_CHAR_CODE('iopx'))
  799.             #define kQ3GroupTypeLight                    ((TQ3ObjectType)FOUR_CHAR_CODE('lghg'))
  800.             #define kQ3GroupTypeInfo                    ((TQ3ObjectType)FOUR_CHAR_CODE('info'))
  801.  
  802.             
  803.         #define kQ3ShapeTypeUnknown                        ((TQ3ObjectType)FOUR_CHAR_CODE('unkn'))
  804.             #define kQ3UnknownTypeText                    ((TQ3ObjectType)FOUR_CHAR_CODE('uktx'))
  805.             #define kQ3UnknownTypeBinary                ((TQ3ObjectType)FOUR_CHAR_CODE('ukbn'))
  806.         #define kQ3ShapeTypeReference                    ((TQ3ObjectType)FOUR_CHAR_CODE('rfrn'))
  807.             #define kQ3ReferenceTypeExternal            ((TQ3ObjectType)FOUR_CHAR_CODE('rfex'))
  808.     #define kQ3SharedTypeSet                            ((TQ3ObjectType)FOUR_CHAR_CODE('set '))
  809.         #define kQ3SetTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('attr'))
  810.     #define kQ3SharedTypeDrawContext                    ((TQ3ObjectType)FOUR_CHAR_CODE('dctx'))
  811.         #define kQ3DrawContextTypePixmap                ((TQ3ObjectType)FOUR_CHAR_CODE('dpxp'))
  812.         #define kQ3DrawContextTypeMacintosh                ((TQ3ObjectType)FOUR_CHAR_CODE('dmac'))
  813.         #define kQ3DrawContextTypeWin32DC                ((TQ3ObjectType)FOUR_CHAR_CODE('dw32'))
  814.         #define kQ3DrawContextTypeDDSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('ddds'))
  815.         #define kQ3DrawContextTypeX11                    ((TQ3ObjectType)FOUR_CHAR_CODE('dx11'))
  816.     #define kQ3SharedTypeTexture                        ((TQ3ObjectType)FOUR_CHAR_CODE('txtr'))
  817.         #define kQ3TextureTypePixmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txpm'))    
  818.         #define kQ3TextureTypeMipmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txmm'))    
  819.  
  820.             
  821.     #define kQ3SharedTypeFile                            ((TQ3ObjectType)FOUR_CHAR_CODE('file'))
  822.     #define kQ3SharedTypeStorage                        ((TQ3ObjectType)FOUR_CHAR_CODE('strg'))
  823.         #define kQ3StorageTypeMemory                    ((TQ3ObjectType)FOUR_CHAR_CODE('mems'))
  824.         #define kQ3MemoryStorageTypeHandle                ((TQ3ObjectType)FOUR_CHAR_CODE('hndl'))
  825.         #define kQ3StorageTypeUnix                        ((TQ3ObjectType)FOUR_CHAR_CODE('uxst'))
  826.         #define kQ3UnixStorageTypePath                    ((TQ3ObjectType)FOUR_CHAR_CODE('unix'))
  827.         #define kQ3StorageTypeMacintosh                    ((TQ3ObjectType)FOUR_CHAR_CODE('macn'))
  828.         #define kQ3MacintoshStorageTypeFSSpec            ((TQ3ObjectType)FOUR_CHAR_CODE('macp'))                    
  829.         #define kQ3StorageTypeWin32                        ((TQ3ObjectType)FOUR_CHAR_CODE('wist'))
  830.     #define kQ3SharedTypeString                            ((TQ3ObjectType)FOUR_CHAR_CODE('strn'))
  831.         #define kQ3StringTypeCString                    ((TQ3ObjectType)FOUR_CHAR_CODE('strc'))
  832.     #define kQ3SharedTypeShapePart                        ((TQ3ObjectType)FOUR_CHAR_CODE('sprt'))
  833.         #define kQ3ShapePartTypeMeshPart                ((TQ3ObjectType)FOUR_CHAR_CODE('spmh'))
  834.             #define kQ3MeshPartTypeMeshFacePart            ((TQ3ObjectType)FOUR_CHAR_CODE('mfac'))
  835.             #define kQ3MeshPartTypeMeshEdgePart            ((TQ3ObjectType)FOUR_CHAR_CODE('medg'))
  836.             #define kQ3MeshPartTypeMeshVertexPart        ((TQ3ObjectType)FOUR_CHAR_CODE('mvtx'))
  837.     #define kQ3SharedTypeControllerState                ((TQ3ObjectType)FOUR_CHAR_CODE('ctst'))
  838.     #define kQ3SharedTypeTracker                        ((TQ3ObjectType)FOUR_CHAR_CODE('trkr'))
  839.     #define kQ3SharedTypeViewHints                        ((TQ3ObjectType)FOUR_CHAR_CODE('vwhn'))
  840.     #define kQ3SharedTypeEndGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('endg'))
  841.  
  842.  
  843. /******************************************************************************
  844.  **                                                                             **
  845.  **                            QuickDraw 3D System Routines                     **
  846.  **                                                                             **
  847.  *****************************************************************************/
  848. EXTERN_API_C( TQ3Status )
  849. Q3Initialize                    (void);
  850.  
  851. EXTERN_API_C( TQ3Status )
  852. Q3Exit                            (void);
  853.  
  854. EXTERN_API_C( TQ3Boolean )
  855. Q3IsInitialized                    (void);
  856.  
  857. EXTERN_API_C( TQ3Status )
  858. Q3GetVersion                    (unsigned long *        majorRevision,
  859.                                  unsigned long *        minorRevision);
  860.  
  861. /*
  862.  *  Q3GetReleaseVersion returns the release version number,
  863.  *  in the format of the first four bytes of a 'vers' resource
  864.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  865.  */
  866. EXTERN_API_C( TQ3Status )
  867. Q3GetReleaseVersion                (unsigned long *        releaseRevision);
  868.  
  869.  
  870. /******************************************************************************
  871.  **                                                                             **
  872.  **                            ObjectClass Routines                             **
  873.  **                                                                             **
  874.  *****************************************************************************/
  875. /* 
  876.  *  New object system calls to query the object system.
  877.  *
  878.  *  These comments to move to the stubs file before final release, they 
  879.  *  are here for documentation for developers using early seeds.
  880.  */
  881. /*
  882.  *  Given a class name as a string return the associated class type for the 
  883.  *  class, may return kQ3Failure if the string representing the class is 
  884.  *  invalid.
  885.  */
  886. EXTERN_API_C( TQ3Status )
  887. Q3ObjectHierarchy_GetTypeFromString (TQ3ObjectClassNameString  objectClassString,
  888.                                  TQ3ObjectType *        objectClassType);
  889.  
  890. /*
  891.  *  Given a class type as return the associated string for the class name, 
  892.  *  may return kQ3Failure if the type representing the class is invalid.
  893.  */
  894. EXTERN_API_C( TQ3Status )
  895. Q3ObjectHierarchy_GetStringFromType (TQ3ObjectType         objectClassType,
  896.                                  TQ3ObjectClassNameString  objectClassString);
  897.  
  898. /* 
  899.  *  Return true if the class with this type is registered, false if not 
  900.  */
  901. EXTERN_API_C( TQ3Boolean )
  902. Q3ObjectHierarchy_IsTypeRegistered (TQ3ObjectType         objectClassType);
  903.  
  904. /* 
  905.  *  Return true if the class with this name is registered, false if not 
  906.  */
  907. EXTERN_API_C( TQ3Boolean )
  908. Q3ObjectHierarchy_IsNameRegistered (const char *        objectClassName);
  909.  
  910. /*
  911.  * TQ3SubClassData is used when querying the object system for
  912.  * the subclasses of a particular parent type:
  913.  */
  914.  
  915. struct TQ3SubClassData {
  916.     unsigned long                     numClasses;                    /* the # of subclass types found for a parent class */
  917.     TQ3ObjectType *                    classTypes;                    /* an array containing the class types */
  918. };
  919. typedef struct TQ3SubClassData            TQ3SubClassData;
  920. /*
  921.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  922.  *  it in with the number and class types of all of the subclasses immediately
  923.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  924.  *  errors occurred, else kQ3Failure.
  925.  *
  926.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  927.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  928.  */
  929. EXTERN_API_C( TQ3Status )
  930. Q3ObjectHierarchy_GetSubClassData (TQ3ObjectType         objectClassType,
  931.                                  TQ3SubClassData *        subClassData);
  932.  
  933. /*
  934.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  935.  *    by the Q3ObjectClass_GetSubClassData call.
  936.  *
  937.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  938.  *  to avoid memory leaks.
  939.  */
  940. EXTERN_API_C( TQ3Status )
  941. Q3ObjectHierarchy_EmptySubClassData (TQ3SubClassData *    subClassData);
  942.  
  943.  
  944. /******************************************************************************
  945.  **                                                                             **
  946.  **                                Object Routines                                 **
  947.  **                                                                             **
  948.  *****************************************************************************/
  949. EXTERN_API_C( TQ3Status )
  950. Q3Object_Dispose                (TQ3Object                 object);
  951.  
  952. EXTERN_API_C( TQ3Object )
  953. Q3Object_Duplicate                (TQ3Object                 object);
  954.  
  955. EXTERN_API_C( TQ3Status )
  956. Q3Object_Submit                    (TQ3Object                 object,
  957.                                  TQ3ViewObject             view);
  958.  
  959. EXTERN_API_C( TQ3Boolean )
  960. Q3Object_IsDrawable                (TQ3Object                 object);
  961.  
  962. EXTERN_API_C( TQ3Boolean )
  963. Q3Object_IsWritable                (TQ3Object                 object,
  964.                                  TQ3FileObject             theFile);
  965.  
  966.  
  967. /******************************************************************************
  968.  **                                                                             **
  969.  **                            Object Type Routines                             **
  970.  **                                                                             **
  971.  *****************************************************************************/
  972. EXTERN_API_C( TQ3ObjectType )
  973. Q3Object_GetType                (TQ3Object                 object);
  974.  
  975. EXTERN_API_C( TQ3ObjectType )
  976. Q3Object_GetLeafType            (TQ3Object                 object);
  977.  
  978. EXTERN_API_C( TQ3Boolean )
  979. Q3Object_IsType                    (TQ3Object                 object,
  980.                                  TQ3ObjectType             theType);
  981.  
  982.  
  983. /******************************************************************************
  984.  **                                                                             **
  985.  **                            Shared Object Routines                             **
  986.  **                                                                             **
  987.  *****************************************************************************/
  988. EXTERN_API_C( TQ3ObjectType )
  989. Q3Shared_GetType                (TQ3SharedObject         sharedObject);
  990.  
  991. EXTERN_API_C( TQ3SharedObject )
  992. Q3Shared_GetReference            (TQ3SharedObject         sharedObject);
  993.  
  994. /* 
  995.  *    Q3Shared_IsReferenced
  996.  *        Returns kQ3True if there is more than one reference to sharedObject.
  997.  *        Returns kQ3False if there is ONE reference to sharedObject.
  998.  *    
  999.  *    This call is intended to allow applications and plug-in objects to delete
  1000.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  1001.  *    caching objects, etc.
  1002.  *    
  1003.  *    Although many may be tempted, DO NOT DO THIS:
  1004.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  1005.  *    
  1006.  *    Your application will crash and no one will buy it. Chapter 11 is 
  1007.  *    never fun (unless you short the stock). Thanks.
  1008.  */
  1009. EXTERN_API_C( TQ3Boolean )
  1010. Q3Shared_IsReferenced            (TQ3SharedObject         sharedObject);
  1011.  
  1012. /*
  1013.  *    Q3Shared_GetEditIndex
  1014.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  1015.  *        object information. Returns 0 on error.
  1016.  *        
  1017.  *        Hold onto this number to determine if an object has changed since you
  1018.  *        last built your caches... To validate, do:
  1019.  *        
  1020.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1021.  *            // Cache is valid
  1022.  *        } else {
  1023.  *            // Cache is invalid
  1024.  *            RebuildSomeSortOfCache(foo);
  1025.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1026.  *        }
  1027.  */
  1028. EXTERN_API_C( unsigned long )
  1029. Q3Shared_GetEditIndex            (TQ3SharedObject         sharedObject);
  1030.  
  1031. /*
  1032.  *    Q3Shared_Edited
  1033.  *        Bumps the "serial number" of sharedObject to a different value. This
  1034.  *        call is intended to be used solely from a plug-in object which is 
  1035.  *        shared. Call this whenever your private instance data changes.
  1036.  *        
  1037.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1038.  *            QuickDraw 3D isn't initialized.
  1039.  */
  1040. EXTERN_API_C( TQ3Status )
  1041. Q3Shared_Edited                    (TQ3SharedObject         sharedObject);
  1042.  
  1043.  
  1044. /******************************************************************************
  1045.  **                                                                             **
  1046.  **                                Shape Routines                                 **
  1047.  **                                                                             **
  1048.  *****************************************************************************/
  1049. /*
  1050.  *    QuickDraw 3D 1.5 Note:
  1051.  *
  1052.  *    Shapes and Sets are now (sort of) polymorphic.
  1053.  *
  1054.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1055.  *        The following calls are identical, in implementation:
  1056.  *
  1057.  *            Q3Shape_GetElement            =    Q3Set_Get
  1058.  *            Q3Shape_AddElement            =    Q3Set_Add
  1059.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1060.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1061.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1062.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1063.  *
  1064.  *    All of these calls accept a shape or a set as their first parameter.
  1065.  *
  1066.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1067.  *    element type kQ3ElementTypeSet. See the note above about 
  1068.  *    kQ3ElementTypeSet;
  1069.  *
  1070.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1071.  *    create a set on a shape and then add the element to it. This data is
  1072.  *    attached directly to the shape. Therefore, it is possible for an element
  1073.  *    to exist on a shape without a set existing on it as well. 
  1074.  *
  1075.  *    In your application, if you attach an element to a shape like this:
  1076.  *        (this isn't checking for errors for simplicity)
  1077.  *
  1078.  *        set = Q3Set_New();
  1079.  *        Q3Set_AddElement(set, kMyElemType, &data);
  1080.  *        Q3Shape_SetSet(shape, set);
  1081.  *
  1082.  *    You should retrieve it in the same manner:
  1083.  *
  1084.  *        Q3Shape_GetSet(shape, &set);
  1085.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) {
  1086.  *            Q3Set_Get(set, kMyElemType, &data);
  1087.  *        }
  1088.  *
  1089.  *    Similarly, if you attach data to a shape with the new calls:
  1090.  *
  1091.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  1092.  *
  1093.  *    You should retrieve it in the same manner:
  1094.  *
  1095.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) {
  1096.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  1097.  *        }
  1098.  *
  1099.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1100.  *    metafiles.
  1101.  *
  1102.  *    When attempting to find a particular element on a shape, you should
  1103.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1104.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1105.  *    and then Q3Shape_GetElement(set, ...).
  1106.  *
  1107.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1108.  *    used for sets of information that are shared among multiple shapes.
  1109.  *    
  1110.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1111.  *    for elements that are unique for a particular shape.
  1112.  *    
  1113.  */
  1114. EXTERN_API_C( TQ3ObjectType )
  1115. Q3Shape_GetType                    (TQ3ShapeObject         shape);
  1116.  
  1117. EXTERN_API_C( TQ3Status )
  1118. Q3Shape_GetSet                    (TQ3ShapeObject         shape,
  1119.                                  TQ3SetObject *            theSet);
  1120.  
  1121. EXTERN_API_C( TQ3Status )
  1122. Q3Shape_SetSet                    (TQ3ShapeObject         shape,
  1123.                                  TQ3SetObject             theSet);
  1124.  
  1125. EXTERN_API_C( TQ3Status )
  1126. Q3Shape_AddElement                (TQ3ShapeObject         shape,
  1127.                                  TQ3ElementType         theType,
  1128.                                  const void *            data);
  1129.  
  1130. EXTERN_API_C( TQ3Status )
  1131. Q3Shape_GetElement                (TQ3ShapeObject         shape,
  1132.                                  TQ3ElementType         theType,
  1133.                                  void *                    data);
  1134.  
  1135. EXTERN_API_C( TQ3Boolean )
  1136. Q3Shape_ContainsElement            (TQ3ShapeObject         shape,
  1137.                                  TQ3ElementType         theType);
  1138.  
  1139. EXTERN_API_C( TQ3Status )
  1140. Q3Shape_GetNextElementType        (TQ3ShapeObject         shape,
  1141.                                  TQ3ElementType *        theType);
  1142.  
  1143. EXTERN_API_C( TQ3Status )
  1144. Q3Shape_EmptyElements            (TQ3ShapeObject         shape);
  1145.  
  1146. EXTERN_API_C( TQ3Status )
  1147. Q3Shape_ClearElement            (TQ3ShapeObject         shape,
  1148.                                  TQ3ElementType         theType);
  1149.  
  1150.  
  1151. /******************************************************************************
  1152.  **                                                                             **
  1153.  **                            Color Table Routines                             **
  1154.  **                                                                             **
  1155.  *****************************************************************************/
  1156. EXTERN_API_C( TQ3Status )
  1157. Q3Bitmap_Empty                    (TQ3Bitmap *            bitmap);
  1158.  
  1159. EXTERN_API_C( unsigned long )
  1160. Q3Bitmap_GetImageSize            (unsigned long             width,
  1161.                                  unsigned long             height);
  1162.  
  1163.  
  1164.  
  1165.  
  1166. #if PRAGMA_ENUM_ALWAYSINT
  1167.     #pragma enumsalwaysint reset
  1168. #elif PRAGMA_ENUM_OPTIONS
  1169.     #pragma option enum=reset
  1170. #elif defined(PRAGMA_ENUM_PACK__QD3D__)
  1171.     #pragma options(pack_enums)
  1172. #endif
  1173.  
  1174. #if PRAGMA_STRUCT_ALIGN
  1175.     #pragma options align=reset
  1176. #elif PRAGMA_STRUCT_PACKPUSH
  1177.     #pragma pack(pop)
  1178. #elif PRAGMA_STRUCT_PACK
  1179.     #pragma pack()
  1180. #endif
  1181.  
  1182. #ifdef PRAGMA_IMPORT_OFF
  1183. #pragma import off
  1184. #elif PRAGMA_IMPORT
  1185. #pragma import reset
  1186. #endif
  1187.  
  1188. #ifdef __cplusplus
  1189. }
  1190. #endif
  1191.  
  1192. #endif /* __QD3D__ */
  1193.  
  1194.